Skip to content

fix(core): accept deprecated reference config key#31659

Merged
Hona merged 1 commit into
devfrom
fix/config-reference-back-compat
Jun 10, 2026
Merged

fix(core): accept deprecated reference config key#31659
Hona merged 1 commit into
devfrom
fix/config-reference-back-compat

Conversation

@Hona

@Hona Hona commented Jun 10, 2026

Copy link
Copy Markdown
Member

Problem

The `release patch` run failed (https://github.com/anomalyco/opencode/actions/runs/27264318252): the changelog step installs the latest published opencode and runs it against this repo, and `.opencode/opencode.jsonc` on dev uses the new `references` key from #31601, which released builds reject:

Error: Configuration is invalid at .opencode/opencode.jsonc
↳ Unrecognized key: references

Beyond CI, #31601 renamed `reference` → `references` and removed the old key from the schema entirely, so any existing user config with `reference` hard-errors on upgrade.

Fix

Restore the established deprecated-key pattern (same treatment as `autoshare`→`share` and `mode`→`agent`, which remain in the schema):

  • re-add `reference` to `ConfigV1.Info` with an `@deprecated` description, reusing `ConfigReference.Info` (old entry shapes are a strict subset of the new ones, so the migration is lossless)
  • restore `"reference"` to the v1 detection keys and coalesce `references: info.references ?? info.reference` in `ConfigMigrateV1.migrate`
  • flip `.opencode/opencode.jsonc` to the singular form so the release pipeline works with both the currently published binary (native key) and dev builds (via migration); flip back once a release containing this lands
  • regenerate the JS SDK

Verification

  • new file-based migration tests in core and opencode config suites, mirroring the existing autoshare/mode migration tests (fail before, pass after)
  • full config + reference suites pass in packages/core (48) and packages/opencode (93); typecheck clean in core, opencode, sdk/js
  • ran released 1.17.0 and a source build against the updated repo config: both load it (1.17.0 verified end-to-end with a real prompt)

Follow-up worth considering separately: have the changelog step run the source build from the release commit instead of npm-latest, which removes this class of failure entirely.

Copilot AI review requested due to automatic review settings June 10, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores backward compatibility for the deprecated top-level config key reference (singular) after the rename to references (plural), ensuring older published binaries and existing user configs don’t hard-error while newer builds continue using the canonical references field.

Changes:

  • Re-add deprecated reference to the v1 config schema and include it in v1 detection/migration.
  • Migrate referencereferences during v1→v2 config migration and add regression tests for detection + migration.
  • Update repo .opencode/opencode.jsonc and regenerate the JS SDK types to accept the deprecated key.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/sdk/js/src/v2/gen/types.gen.ts Updates generated SDK config types to also accept deprecated reference.
packages/opencode/test/config/config.test.ts Adds a test ensuring v1 schema validation accepts the deprecated reference key.
packages/core/test/config/config.test.ts Adds v1 detection and migration coverage for referencereferences.
packages/core/src/v1/config/migrate.ts Treats reference as a v1-only key and coalesces into references during migration.
packages/core/src/v1/config/config.ts Re-introduces reference in the v1 schema with a deprecated description.
.opencode/opencode.jsonc Temporarily switches repo config to reference so release pipelines using older binaries can load it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona Hona enabled auto-merge (squash) June 10, 2026 10:25
@Hona Hona merged commit 90fb32b into dev Jun 10, 2026
11 checks passed
@Hona Hona deleted the fix/config-reference-back-compat branch June 10, 2026 10:32
ShamirSecret pushed a commit to ShamirSecret/auto-code-machine that referenced this pull request Jun 11, 2026
isaacfinnegan pushed a commit to isaacfinnegan/whispercode that referenced this pull request Jun 15, 2026
davidgut1982 pushed a commit to davidgut1982/opencode that referenced this pull request Jun 19, 2026
markjaquith pushed a commit to markjaquith/opencode that referenced this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants